package com.dhj.yygh.controller;

import com.dhj.yygh.client.OrderClient;
import com.dhj.yygh.common.result.MyResult;
import com.dhj.yygh.vo.order.OrderCountQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(tags = "统计数据的相关接口")
@RestController
@RequestMapping("/admin/statistics")
public class StatisticsController {

    @Autowired
    OrderClient orderClient;

    @ApiOperation("统计每天的订单数据")
    @GetMapping("/getOrderStatistics")
    public MyResult<Map<String, Object>> getOrderStatistics(OrderCountQueryVo orderCountQueryVo) {
        /*
        尽管远程调用的接口为 post 提交，但是若通过直接调用方法的方式传入参数，则忽略请求方式
         */
        Map<String, Object> countMap = orderClient.getCountMap(orderCountQueryVo);

        return MyResult.ok(countMap);
    }
}
